package com.kcl.dfss;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;

public class AppPrivacyActivity extends Activity {

	private LinearLayout privacy_back;
	private TextView text_privacy;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_app_privacy);
		
		privacy_back = (LinearLayout) findViewById(R.id.privacy_back);
		text_privacy = (TextView) findViewById(R.id.text_privacy);
		
		privacy_back.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		
		InputStream inputStream = getResources().openRawResource(R.raw.app_privacy);
		text_privacy.setText(getString(inputStream));
		
	}
	
	public String getString(InputStream inputStream){
		InputStreamReader inputStreamReader = null;
		inputStreamReader = new InputStreamReader(inputStream);
		BufferedReader reader = new BufferedReader(inputStreamReader);
		StringBuffer sb = new StringBuffer();
		String line;
		try {
			while((line = reader.readLine()) != null){
				sb.append(line);
				sb.append("\n");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return sb.toString();
	}

}
